#pragma once
#include <DataCore/sim_data.h>

namespace PhysLeo
{
  
/**
 * gravity cpu module
 * G = m*g
 */
template<typename T>
class GravityCpu
{
public:
    /**
    * empty constructor
    */
    GravityCpu() = default;

    /**
     * delete default copy constructor
     */
    GravityCpu(const GravityCpu<T>&) = delete;

    /**
     * delete default move constructor
     */
    GravityCpu(GravityCpu<T>&&) = delete;

    /**
     * delete default copy assignment function
     */
    GravityCpu<T>& operator=(const GravityCpu<T>&) = delete;

    /**
     * delete default move assignment function
     */
    GravityCpu<T>& operator=(GravityCpu<T>&&) = delete;

    /**
    * virtual destructor
    */
    virtual ~GravityCpu() = default;

    /**
    * allocate resource for fixed freedom module
    * @param simData  simulation data
    */
    virtual void allocateResource(SimData<T>& simData);

    /**
     * getter of velocity_damping_param_
     * @return gravity acceleration type glm::tvec3<T> 
     */
    glm::tvec3<T> getGravityAcceleration() { return gravity_acceleration_; }

    /**
     * setter of velocity_damping_param_
     * @param gravity_acceleration   gravity acceleration to be setted
     */
    void setGravityAcceleration(glm::tvec3<T> gravity_acceleration) { gravity_acceleration_ = gravity_acceleration; }

    /**
    * add gravity force on the force buffer data
    * @param force  force buffer data 
    */
    virtual void addGravityForce(std::shared_ptr<BufferData<glm::tvec3<T>>> force);

protected:
    /**
     * the mass buffer data
     */
    std::shared_ptr<BufferData<T>> ptr_mass_;

    /**
     * gravity acceleration
     */
    glm::tvec3<T> gravity_acceleration_;
};

}